import 'package:flutter/material.dart';
import 'package:go/routes/fluro_navigator.dart';
import 'package:go/routes/router_init.dart';
import 'package:go/util/fluro_convert_util.dart';

class HomePage extends StatefulWidget {

  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {

  @override
  Widget build(BuildContext context) {
     return Scaffold(
      appBar: AppBar(
        title: Text('首页'),
      ),
      body: Center(
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: (){

        // 路由跳转工具类测试 
         
         //1. 跳转next页面
        //  NavigatorUtils.push(context,MyPageRouter.homePage);

         //2. 带参跳转next页面
            //2.1 非中文
            //  NavigatorUtils.push(context,'${MyPageRouter.homePage}?message=teststring');

            //2.2 中文字符串 （传递前进行编码，下级页面转码）
             String chstr = FluroConvertUtils.fluroCnParamsEncode('你好');
             NavigatorUtils.push(context,'${MyPageRouter.homePage}?message=$chstr');

         //3. 跳转webview
        //  NavigatorUtils.goWebViewPage(context, 'dartapi','https://api.flutter.dev/flutter/widgets/BuildContext-class.html');


        },
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}